/**
 * 数据库连接工具类
 * @param callback
 */
var settings=require('./constant.settings')
module.exports = function (callback) {
  global.favorite = global.favorite || {};
  global.favorite.db ? callback(null, global.favorite.db) : require('mongodb').MongoClient.connect(settings.dbconnect, function (err, db) {
    global.favorite.db = global.favorite.db || db;
    callback(err, global.favorite.db);
  });
};
